#include "stdafx.h"
#include "CasualGameServer.h"

CasualGameServer::CasualGameServer(void)
	: ioLoop_(), server_(ioLoop_, this), packetProducer_(), room_()
{
}


CasualGameServer::~CasualGameServer(void)
{
}


void CasualGameServer::OnLogin(uint64_t userId)
{
	std::cout << "[CasualGameServer::OnLogin] " << userId << std::endl;
}

void CasualGameServer::Start()
{
	size_t maxRoom = 1;
	size_t maxHeight = 10;
	size_t maxWidth = 10;

	for(size_t i = 0; i < maxRoom; ++i)
	{
		room_.push_back(new Room(maxWidth, maxHeight));
	}

	ioLoop_.Start();
	server_.Start(std::string("0.0.0.0"), std::string("9000"));
}

void CasualGameServer::Stop()
{
	ioLoop_.Stop();
	server_.Stop();
}